<?php
namespace App\Models\Operation;

use Illuminate\Database\Eloquent\Model;

use Encore\Admin\Form;

class BaseModel extends Model
{
    public static function getPresents() {
        return [
            0 => '无',
            1 => '有',
        ];
    }
    public static function getItemTypes() {
        return [
            0 => '随车',
            1 => '留库',
        ];
    }
    public static function getPayTypes() {
        return [
            0 => '甲方',
            1 => '出货人',
        ];
    }
    public static function getStates() {
        return [
            0 => '已提交',
            1 => '处理中',
            2 => '送货中',
            3 => '已完成',
        ];
    }

    public function form($form)
    {
        $states = self::getStates();

        $form->currency('task.fee', __('Fee'));
        $form->text('task.pricing', __('Pricing'));
        $form->text('pay_link', __('Pay link'));
        $form->select('task.state', __('State'))->options($states);
        $form->date('task.completed_at', __('Completed at'));
        $form->textarea('task.feedback', __('Feedback'));
        $form->textarea('task.remark', __('Remark'));
        $form->hasMany('photos', __('Photos'), function (Form\NestedForm $form) {
            $form->text('title', __('Title'));
            $form->multipleFile('photos', __('Photos'))->sortable()->removable()->options(["language" => "zh"]);
        });
    }
}
